{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "2d6d417e-6756-450a-af36-77138195cb67",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "022ddd59-8840-4e36-ba02-ea04ba58d1a3",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Vehicle_ID</th>\n",
       "      <th>Frame_ID</th>\n",
       "      <th>Total_Frames</th>\n",
       "      <th>Global_Time</th>\n",
       "      <th>Local_X</th>\n",
       "      <th>Local_Y</th>\n",
       "      <th>Global_X</th>\n",
       "      <th>Global_Y</th>\n",
       "      <th>v_Length</th>\n",
       "      <th>v_Width</th>\n",
       "      <th>...</th>\n",
       "      <th>Lane_ID</th>\n",
       "      <th>Preceeding</th>\n",
       "      <th>Following</th>\n",
       "      <th>Space_Hdwy</th>\n",
       "      <th>Time_Hdwy</th>\n",
       "      <th>x</th>\n",
       "      <th>x_a</th>\n",
       "      <th>y</th>\n",
       "      <th>y_v</th>\n",
       "      <th>label</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>609</td>\n",
       "      <td>569</td>\n",
       "      <td>1118847902900</td>\n",
       "      <td>51.763</td>\n",
       "      <td>1021.948700</td>\n",
       "      <td>6451804.992</td>\n",
       "      <td>1872671.825</td>\n",
       "      <td>47.0</td>\n",
       "      <td>8.5</td>\n",
       "      <td>...</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>16</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.014</td>\n",
       "      <td>0.14</td>\n",
       "      <td>3.605799</td>\n",
       "      <td>36.057987</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>610</td>\n",
       "      <td>569</td>\n",
       "      <td>1118847903000</td>\n",
       "      <td>51.818</td>\n",
       "      <td>1025.581515</td>\n",
       "      <td>6451807.597</td>\n",
       "      <td>1872669.488</td>\n",
       "      <td>47.0</td>\n",
       "      <td>8.5</td>\n",
       "      <td>...</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>16</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.055</td>\n",
       "      <td>0.55</td>\n",
       "      <td>3.632815</td>\n",
       "      <td>36.328145</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>611</td>\n",
       "      <td>569</td>\n",
       "      <td>1118847903100</td>\n",
       "      <td>51.891</td>\n",
       "      <td>1029.241983</td>\n",
       "      <td>6451810.187</td>\n",
       "      <td>1872667.140</td>\n",
       "      <td>47.0</td>\n",
       "      <td>8.5</td>\n",
       "      <td>...</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>16</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.073</td>\n",
       "      <td>0.73</td>\n",
       "      <td>3.660469</td>\n",
       "      <td>36.604687</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>612</td>\n",
       "      <td>569</td>\n",
       "      <td>1118847903200</td>\n",
       "      <td>51.900</td>\n",
       "      <td>1032.931222</td>\n",
       "      <td>6451812.882</td>\n",
       "      <td>1872664.785</td>\n",
       "      <td>47.0</td>\n",
       "      <td>8.5</td>\n",
       "      <td>...</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>16</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.009</td>\n",
       "      <td>0.09</td>\n",
       "      <td>3.689239</td>\n",
       "      <td>36.892390</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>613</td>\n",
       "      <td>569</td>\n",
       "      <td>1118847903300</td>\n",
       "      <td>51.907</td>\n",
       "      <td>1036.650109</td>\n",
       "      <td>6451815.660</td>\n",
       "      <td>1872662.361</td>\n",
       "      <td>47.0</td>\n",
       "      <td>8.5</td>\n",
       "      <td>...</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>16</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.007</td>\n",
       "      <td>0.07</td>\n",
       "      <td>3.718887</td>\n",
       "      <td>37.188865</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46595</th>\n",
       "      <td>1909</td>\n",
       "      <td>7478</td>\n",
       "      <td>939</td>\n",
       "      <td>1118848589800</td>\n",
       "      <td>8.172</td>\n",
       "      <td>1173.721711</td>\n",
       "      <td>6451950.602</td>\n",
       "      <td>1872602.814</td>\n",
       "      <td>10.0</td>\n",
       "      <td>5.5</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>1902</td>\n",
       "      <td>1914</td>\n",
       "      <td>43.40</td>\n",
       "      <td>3.97</td>\n",
       "      <td>0.002</td>\n",
       "      <td>0.02</td>\n",
       "      <td>1.232925</td>\n",
       "      <td>12.329246</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46596</th>\n",
       "      <td>1909</td>\n",
       "      <td>7479</td>\n",
       "      <td>939</td>\n",
       "      <td>1118848589900</td>\n",
       "      <td>8.157</td>\n",
       "      <td>1174.930492</td>\n",
       "      <td>6451951.401</td>\n",
       "      <td>1872602.138</td>\n",
       "      <td>10.0</td>\n",
       "      <td>5.5</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>1902</td>\n",
       "      <td>1914</td>\n",
       "      <td>43.80</td>\n",
       "      <td>4.22</td>\n",
       "      <td>-0.015</td>\n",
       "      <td>-0.15</td>\n",
       "      <td>1.208780</td>\n",
       "      <td>12.087804</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46597</th>\n",
       "      <td>1909</td>\n",
       "      <td>7480</td>\n",
       "      <td>939</td>\n",
       "      <td>1118848590000</td>\n",
       "      <td>8.158</td>\n",
       "      <td>1176.117020</td>\n",
       "      <td>6451952.132</td>\n",
       "      <td>1872601.499</td>\n",
       "      <td>10.0</td>\n",
       "      <td>5.5</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>1902</td>\n",
       "      <td>1914</td>\n",
       "      <td>44.40</td>\n",
       "      <td>4.41</td>\n",
       "      <td>0.001</td>\n",
       "      <td>0.01</td>\n",
       "      <td>1.186528</td>\n",
       "      <td>11.865284</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46598</th>\n",
       "      <td>1909</td>\n",
       "      <td>7481</td>\n",
       "      <td>939</td>\n",
       "      <td>1118848590100</td>\n",
       "      <td>8.160</td>\n",
       "      <td>1177.283423</td>\n",
       "      <td>6451952.885</td>\n",
       "      <td>1872600.841</td>\n",
       "      <td>10.0</td>\n",
       "      <td>5.5</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>1902</td>\n",
       "      <td>1914</td>\n",
       "      <td>45.16</td>\n",
       "      <td>4.53</td>\n",
       "      <td>0.002</td>\n",
       "      <td>0.02</td>\n",
       "      <td>1.166403</td>\n",
       "      <td>11.664030</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46599</th>\n",
       "      <td>1909</td>\n",
       "      <td>7482</td>\n",
       "      <td>939</td>\n",
       "      <td>1118848590200</td>\n",
       "      <td>8.161</td>\n",
       "      <td>1178.431746</td>\n",
       "      <td>6451953.638</td>\n",
       "      <td>1872600.183</td>\n",
       "      <td>10.0</td>\n",
       "      <td>5.5</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>1902</td>\n",
       "      <td>1914</td>\n",
       "      <td>46.06</td>\n",
       "      <td>4.62</td>\n",
       "      <td>0.001</td>\n",
       "      <td>0.01</td>\n",
       "      <td>1.148323</td>\n",
       "      <td>11.483226</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>46600 rows × 23 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       Vehicle_ID  Frame_ID  Total_Frames    Global_Time  Local_X  \\\n",
       "0               1       609           569  1118847902900   51.763   \n",
       "1               1       610           569  1118847903000   51.818   \n",
       "2               1       611           569  1118847903100   51.891   \n",
       "3               1       612           569  1118847903200   51.900   \n",
       "4               1       613           569  1118847903300   51.907   \n",
       "...           ...       ...           ...            ...      ...   \n",
       "46595        1909      7478           939  1118848589800    8.172   \n",
       "46596        1909      7479           939  1118848589900    8.157   \n",
       "46597        1909      7480           939  1118848590000    8.158   \n",
       "46598        1909      7481           939  1118848590100    8.160   \n",
       "46599        1909      7482           939  1118848590200    8.161   \n",
       "\n",
       "           Local_Y     Global_X     Global_Y  v_Length  v_Width  ...  Lane_ID  \\\n",
       "0      1021.948700  6451804.992  1872671.825      47.0      8.5  ...        5   \n",
       "1      1025.581515  6451807.597  1872669.488      47.0      8.5  ...        5   \n",
       "2      1029.241983  6451810.187  1872667.140      47.0      8.5  ...        5   \n",
       "3      1032.931222  6451812.882  1872664.785      47.0      8.5  ...        5   \n",
       "4      1036.650109  6451815.660  1872662.361      47.0      8.5  ...        5   \n",
       "...            ...          ...          ...       ...      ...  ...      ...   \n",
       "46595  1173.721711  6451950.602  1872602.814      10.0      5.5  ...        1   \n",
       "46596  1174.930492  6451951.401  1872602.138      10.0      5.5  ...        1   \n",
       "46597  1176.117020  6451952.132  1872601.499      10.0      5.5  ...        1   \n",
       "46598  1177.283423  6451952.885  1872600.841      10.0      5.5  ...        1   \n",
       "46599  1178.431746  6451953.638  1872600.183      10.0      5.5  ...        1   \n",
       "\n",
       "       Preceeding  Following  Space_Hdwy  Time_Hdwy      x   x_a         y  \\\n",
       "0               0         16        0.00       0.00  0.014  0.14  3.605799   \n",
       "1               0         16        0.00       0.00  0.055  0.55  3.632815   \n",
       "2               0         16        0.00       0.00  0.073  0.73  3.660469   \n",
       "3               0         16        0.00       0.00  0.009  0.09  3.689239   \n",
       "4               0         16        0.00       0.00  0.007  0.07  3.718887   \n",
       "...           ...        ...         ...        ...    ...   ...       ...   \n",
       "46595        1902       1914       43.40       3.97  0.002  0.02  1.232925   \n",
       "46596        1902       1914       43.80       4.22 -0.015 -0.15  1.208780   \n",
       "46597        1902       1914       44.40       4.41  0.001  0.01  1.186528   \n",
       "46598        1902       1914       45.16       4.53  0.002  0.02  1.166403   \n",
       "46599        1902       1914       46.06       4.62  0.001  0.01  1.148323   \n",
       "\n",
       "             y_v  label  \n",
       "0      36.057987      0  \n",
       "1      36.328145      0  \n",
       "2      36.604687      0  \n",
       "3      36.892390      0  \n",
       "4      37.188865      0  \n",
       "...          ...    ...  \n",
       "46595  12.329246      0  \n",
       "46596  12.087804      0  \n",
       "46597  11.865284      0  \n",
       "46598  11.664030      0  \n",
       "46599  11.483226      0  \n",
       "\n",
       "[46600 rows x 23 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f=pd.read_csv(\"./data/KL_train40.csv\")        #直行40帧的数据\n",
    "f2=pd.read_csv(\"./data/RL_label.csv\")         #左右转合并的数据\n",
    "f"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "b4605d19-541e-4885-921d-549c3a95c9e3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1165"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f['Vehicle_ID'].nunique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "3969912d-7f0a-4fbb-8b31-f7cd99bd0c51",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Vehicle_ID\n",
       "1       40\n",
       "1250    40\n",
       "1205    40\n",
       "1204    40\n",
       "1201    40\n",
       "        ..\n",
       "524     40\n",
       "523     40\n",
       "522     40\n",
       "521     40\n",
       "1909    40\n",
       "Name: count, Length: 1165, dtype: int64"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f['Vehicle_ID'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "f1a261df-2498-4883-b724-1a9c517a659f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Lane_ID\n",
       "1    10120\n",
       "2     9840\n",
       "4     9240\n",
       "3     9200\n",
       "5     8200\n",
       "Name: count, dtype: int64"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f['Lane_ID'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "92e769ca-4d97-4759-88e9-0c885b8774ae",
   "metadata": {},
   "outputs": [],
   "source": [
    "def normalize(train):          # 数据标准化，对于数据中的每一列（如果 train 是一个 DataFrame），它使用 apply 方法应用了一个匿名函数，这个匿名函数对每一列 x 执行了标准化操作。\n",
    "                                #标准化操作是将每个值减去该列的均值，并除以该列的极差（最大值减去最小值）\n",
    "  train_norm = train.apply(lambda x: (x - np.mean(x)) / (np.max(x) - np.min(x)))\n",
    "  return train_norm"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "6d05e019-29ec-4351-bc81-3a589dd8bbfe",
   "metadata": {},
   "outputs": [],
   "source": [
    "F1=f[['Vehicle_ID','Frame_ID','Local_X','Local_Y','v_Class','v_Vel','v_Acc','Lane_ID','x_a','label']]\n",
    "F2=f2[['Vehicle_ID','Frame_ID','Local_X','Local_Y','v_Class','v_Vel','v_Acc','Lane_ID','x_a','label']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "8665aeea-0bb9-4acf-84f5-51868e5b3d35",
   "metadata": {},
   "outputs": [],
   "source": [
    "df_combine = pd.concat([F1,F2], ignore_index=True)\n",
    "df_combine.to_csv(\"./data/Doubel_label.csv\",index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "d5992ae2-9426-45cc-8e8b-315450c8761f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Vehicle_ID</th>\n",
       "      <th>Frame_ID</th>\n",
       "      <th>Local_X</th>\n",
       "      <th>Local_Y</th>\n",
       "      <th>v_Class</th>\n",
       "      <th>v_Vel</th>\n",
       "      <th>v_Acc</th>\n",
       "      <th>Lane_ID</th>\n",
       "      <th>x_a</th>\n",
       "      <th>label</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>609</td>\n",
       "      <td>51.763</td>\n",
       "      <td>1021.948700</td>\n",
       "      <td>3</td>\n",
       "      <td>36.193508</td>\n",
       "      <td>2.676641</td>\n",
       "      <td>5</td>\n",
       "      <td>0.14</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>610</td>\n",
       "      <td>51.818</td>\n",
       "      <td>1025.581515</td>\n",
       "      <td>3</td>\n",
       "      <td>36.470313</td>\n",
       "      <td>2.720030</td>\n",
       "      <td>5</td>\n",
       "      <td>0.55</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>611</td>\n",
       "      <td>51.891</td>\n",
       "      <td>1029.241983</td>\n",
       "      <td>3</td>\n",
       "      <td>36.752818</td>\n",
       "      <td>2.797069</td>\n",
       "      <td>5</td>\n",
       "      <td>0.73</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>612</td>\n",
       "      <td>51.900</td>\n",
       "      <td>1032.931222</td>\n",
       "      <td>3</td>\n",
       "      <td>37.041677</td>\n",
       "      <td>2.852058</td>\n",
       "      <td>5</td>\n",
       "      <td>0.09</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>613</td>\n",
       "      <td>51.907</td>\n",
       "      <td>1036.650109</td>\n",
       "      <td>3</td>\n",
       "      <td>37.332312</td>\n",
       "      <td>2.834137</td>\n",
       "      <td>5</td>\n",
       "      <td>0.07</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59715</th>\n",
       "      <td>1914</td>\n",
       "      <td>7000</td>\n",
       "      <td>13.153</td>\n",
       "      <td>366.480825</td>\n",
       "      <td>2</td>\n",
       "      <td>34.242836</td>\n",
       "      <td>-2.424565</td>\n",
       "      <td>2</td>\n",
       "      <td>-1.54</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59716</th>\n",
       "      <td>1914</td>\n",
       "      <td>7001</td>\n",
       "      <td>12.851</td>\n",
       "      <td>369.891951</td>\n",
       "      <td>2</td>\n",
       "      <td>34.012738</td>\n",
       "      <td>-2.247724</td>\n",
       "      <td>2</td>\n",
       "      <td>-3.02</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59717</th>\n",
       "      <td>1914</td>\n",
       "      <td>7002</td>\n",
       "      <td>12.519</td>\n",
       "      <td>373.280969</td>\n",
       "      <td>2</td>\n",
       "      <td>33.799112</td>\n",
       "      <td>-2.080567</td>\n",
       "      <td>2</td>\n",
       "      <td>-3.32</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59718</th>\n",
       "      <td>1914</td>\n",
       "      <td>7003</td>\n",
       "      <td>12.212</td>\n",
       "      <td>376.649614</td>\n",
       "      <td>2</td>\n",
       "      <td>33.600454</td>\n",
       "      <td>-1.942366</td>\n",
       "      <td>2</td>\n",
       "      <td>-3.07</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59719</th>\n",
       "      <td>1914</td>\n",
       "      <td>7004</td>\n",
       "      <td>11.904</td>\n",
       "      <td>379.999326</td>\n",
       "      <td>2</td>\n",
       "      <td>33.413677</td>\n",
       "      <td>-1.840038</td>\n",
       "      <td>2</td>\n",
       "      <td>-3.08</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>59720 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       Vehicle_ID  Frame_ID  Local_X      Local_Y  v_Class      v_Vel  \\\n",
       "0               1       609   51.763  1021.948700        3  36.193508   \n",
       "1               1       610   51.818  1025.581515        3  36.470313   \n",
       "2               1       611   51.891  1029.241983        3  36.752818   \n",
       "3               1       612   51.900  1032.931222        3  37.041677   \n",
       "4               1       613   51.907  1036.650109        3  37.332312   \n",
       "...           ...       ...      ...          ...      ...        ...   \n",
       "59715        1914      7000   13.153   366.480825        2  34.242836   \n",
       "59716        1914      7001   12.851   369.891951        2  34.012738   \n",
       "59717        1914      7002   12.519   373.280969        2  33.799112   \n",
       "59718        1914      7003   12.212   376.649614        2  33.600454   \n",
       "59719        1914      7004   11.904   379.999326        2  33.413677   \n",
       "\n",
       "          v_Acc  Lane_ID   x_a  label  \n",
       "0      2.676641        5  0.14      0  \n",
       "1      2.720030        5  0.55      0  \n",
       "2      2.797069        5  0.73      0  \n",
       "3      2.852058        5  0.09      0  \n",
       "4      2.834137        5  0.07      0  \n",
       "...         ...      ...   ...    ...  \n",
       "59715 -2.424565        2 -1.54      1  \n",
       "59716 -2.247724        2 -3.02      1  \n",
       "59717 -2.080567        2 -3.32      1  \n",
       "59718 -1.942366        2 -3.07      1  \n",
       "59719 -1.840038        2 -3.08      1  \n",
       "\n",
       "[59720 rows x 10 columns]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_combine"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "78e2fb5d-d6c1-4f6d-b7ad-542be854f8da",
   "metadata": {},
   "outputs": [],
   "source": [
    "df_combine=normalize(df_combine)\n",
    "df_combine.to_csv(\"./data/Double_train.csv\",index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "70a2ad11-c405-4439-9076-fac8e10a5ccf",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Vehicle_ID</th>\n",
       "      <th>Frame_ID</th>\n",
       "      <th>Local_X</th>\n",
       "      <th>Local_Y</th>\n",
       "      <th>v_Class</th>\n",
       "      <th>v_Vel</th>\n",
       "      <th>v_Acc</th>\n",
       "      <th>Lane_ID</th>\n",
       "      <th>x_a</th>\n",
       "      <th>label</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-0.453411</td>\n",
       "      <td>-0.427663</td>\n",
       "      <td>0.336651</td>\n",
       "      <td>-0.033182</td>\n",
       "      <td>0.496986</td>\n",
       "      <td>0.042993</td>\n",
       "      <td>0.163113</td>\n",
       "      <td>0.328533</td>\n",
       "      <td>0.009679</td>\n",
       "      <td>-0.14501</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-0.453411</td>\n",
       "      <td>-0.427534</td>\n",
       "      <td>0.337500</td>\n",
       "      <td>-0.031485</td>\n",
       "      <td>0.496986</td>\n",
       "      <td>0.046863</td>\n",
       "      <td>0.165946</td>\n",
       "      <td>0.328533</td>\n",
       "      <td>0.026291</td>\n",
       "      <td>-0.14501</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-0.453411</td>\n",
       "      <td>-0.427405</td>\n",
       "      <td>0.338627</td>\n",
       "      <td>-0.029775</td>\n",
       "      <td>0.496986</td>\n",
       "      <td>0.050812</td>\n",
       "      <td>0.170978</td>\n",
       "      <td>0.328533</td>\n",
       "      <td>0.033585</td>\n",
       "      <td>-0.14501</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>-0.453411</td>\n",
       "      <td>-0.427275</td>\n",
       "      <td>0.338766</td>\n",
       "      <td>-0.028051</td>\n",
       "      <td>0.496986</td>\n",
       "      <td>0.054851</td>\n",
       "      <td>0.174569</td>\n",
       "      <td>0.328533</td>\n",
       "      <td>0.007653</td>\n",
       "      <td>-0.14501</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>-0.453411</td>\n",
       "      <td>-0.427146</td>\n",
       "      <td>0.338874</td>\n",
       "      <td>-0.026314</td>\n",
       "      <td>0.496986</td>\n",
       "      <td>0.058915</td>\n",
       "      <td>0.173399</td>\n",
       "      <td>0.328533</td>\n",
       "      <td>0.006842</td>\n",
       "      <td>-0.14501</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59715</th>\n",
       "      <td>0.546589</td>\n",
       "      <td>0.399650</td>\n",
       "      <td>-0.259376</td>\n",
       "      <td>-0.339379</td>\n",
       "      <td>-0.003014</td>\n",
       "      <td>0.015719</td>\n",
       "      <td>-0.170053</td>\n",
       "      <td>-0.171467</td>\n",
       "      <td>-0.058393</td>\n",
       "      <td>0.35499</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59716</th>\n",
       "      <td>0.546589</td>\n",
       "      <td>0.399780</td>\n",
       "      <td>-0.264038</td>\n",
       "      <td>-0.337785</td>\n",
       "      <td>-0.003014</td>\n",
       "      <td>0.012502</td>\n",
       "      <td>-0.158504</td>\n",
       "      <td>-0.171467</td>\n",
       "      <td>-0.118360</td>\n",
       "      <td>0.35499</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59717</th>\n",
       "      <td>0.546589</td>\n",
       "      <td>0.399909</td>\n",
       "      <td>-0.269163</td>\n",
       "      <td>-0.336202</td>\n",
       "      <td>-0.003014</td>\n",
       "      <td>0.009516</td>\n",
       "      <td>-0.147586</td>\n",
       "      <td>-0.171467</td>\n",
       "      <td>-0.130516</td>\n",
       "      <td>0.35499</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59718</th>\n",
       "      <td>0.546589</td>\n",
       "      <td>0.400039</td>\n",
       "      <td>-0.273902</td>\n",
       "      <td>-0.334628</td>\n",
       "      <td>-0.003014</td>\n",
       "      <td>0.006738</td>\n",
       "      <td>-0.138560</td>\n",
       "      <td>-0.171467</td>\n",
       "      <td>-0.120386</td>\n",
       "      <td>0.35499</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59719</th>\n",
       "      <td>0.546589</td>\n",
       "      <td>0.400168</td>\n",
       "      <td>-0.278657</td>\n",
       "      <td>-0.333064</td>\n",
       "      <td>-0.003014</td>\n",
       "      <td>0.004127</td>\n",
       "      <td>-0.131877</td>\n",
       "      <td>-0.171467</td>\n",
       "      <td>-0.120791</td>\n",
       "      <td>0.35499</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>59720 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       Vehicle_ID  Frame_ID   Local_X   Local_Y   v_Class     v_Vel     v_Acc  \\\n",
       "0       -0.453411 -0.427663  0.336651 -0.033182  0.496986  0.042993  0.163113   \n",
       "1       -0.453411 -0.427534  0.337500 -0.031485  0.496986  0.046863  0.165946   \n",
       "2       -0.453411 -0.427405  0.338627 -0.029775  0.496986  0.050812  0.170978   \n",
       "3       -0.453411 -0.427275  0.338766 -0.028051  0.496986  0.054851  0.174569   \n",
       "4       -0.453411 -0.427146  0.338874 -0.026314  0.496986  0.058915  0.173399   \n",
       "...           ...       ...       ...       ...       ...       ...       ...   \n",
       "59715    0.546589  0.399650 -0.259376 -0.339379 -0.003014  0.015719 -0.170053   \n",
       "59716    0.546589  0.399780 -0.264038 -0.337785 -0.003014  0.012502 -0.158504   \n",
       "59717    0.546589  0.399909 -0.269163 -0.336202 -0.003014  0.009516 -0.147586   \n",
       "59718    0.546589  0.400039 -0.273902 -0.334628 -0.003014  0.006738 -0.138560   \n",
       "59719    0.546589  0.400168 -0.278657 -0.333064 -0.003014  0.004127 -0.131877   \n",
       "\n",
       "        Lane_ID       x_a    label  \n",
       "0      0.328533  0.009679 -0.14501  \n",
       "1      0.328533  0.026291 -0.14501  \n",
       "2      0.328533  0.033585 -0.14501  \n",
       "3      0.328533  0.007653 -0.14501  \n",
       "4      0.328533  0.006842 -0.14501  \n",
       "...         ...       ...      ...  \n",
       "59715 -0.171467 -0.058393  0.35499  \n",
       "59716 -0.171467 -0.118360  0.35499  \n",
       "59717 -0.171467 -0.130516  0.35499  \n",
       "59718 -0.171467 -0.120386  0.35499  \n",
       "59719 -0.171467 -0.120791  0.35499  \n",
       "\n",
       "[59720 rows x 10 columns]"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_combine"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
